package com.infore.airsupervise.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.infore.airsupervise.R;
import com.infore.airsupervise.app.Constants;
import com.infore.airsupervise.bean.PolluterLicenseE;
import com.infore.airsupervise.utils.ToastUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 排污许可证详情
 *
 * @作者: dingxinlin
 * @创建时间: 2017/4/13 17:36
 */
public class LicenseDetailActivity extends BaseTitleBarActivity {

    @BindView(R.id.company_name)
    TextView companyName;
    @BindView(R.id.license_code)
    TextView licenseCode;
    @BindView(R.id.law_person)
    TextView lawPerson;
    @BindView(R.id.address)
    TextView address;
    @BindView(R.id.license_content)
    TextView licenseContent;
    @BindView(R.id.limit_date)
    TextView limitDate;
    @BindView(R.id.sign_office)
    TextView signOffice;
    @BindView(R.id.sign_time)
    TextView signTime;

    private PolluterLicenseE license;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_license_detail);
        ButterKnife.bind(this);

        license = (PolluterLicenseE) getIntent().getExtras().getSerializable(Constants.INTENT_OBJ_KEY);

        initView();
    }

    private void initView() {
        title.setText("排污许可证详情");
        rightMenu.setVisibility(View.GONE);

        if (license == null) {
            ToastUtil.showLong(ctx, "Intent参数传递失败");
            return;
        }

        companyName.setText(license.getCompanyName());
        licenseCode.setText("编号："+ license.getNumber());
        lawPerson.setText("法人代表："+ license.getCompanyPson());
        address.setText("单位地址："+ license.getAddress());
        licenseContent.setText("许可内容："+ license.getContent());
        limitDate.setText("有效期限："+ license.getStartTime() + " 至 " + license.getEndTime());
        signOffice.setText("发证机关："+ license.getCertifyingAuthority());
        signTime.setText("发证时间："+ license.getCertifyingTime());
    }
}
